package com.zp.master.controller.demoCont;



import com.zp.master.modules.entity.SysUser;
import com.zp.master.modules.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/a")
public class demoController {

    @Autowired
    private SysUserService sysUserService;

    @RequestMapping("/index")
    @ResponseBody
    public String index(){
        StringBuffer stringBuffer = new StringBuffer();
        stringBuffer.append("Hello Spring Boot!我爱你");
        stringBuffer.append("--");
        stringBuffer.append("--");
        String a = stringBuffer.toString();
        System.out.println(a);
        return a;
    }

    /**
     * freemarker  测试
     * @param model
     * @return
     */
    @RequestMapping("/freemarker")
    public String toIndex(Model model) {
        List<SysUser> list =  sysUserService.listAll();
        model.addAttribute("name", "lisi");
        return "login";
    }


}
